package com.sunnada.demo.log.controller;

import com.sunnada.demo.common.PagerItem;
import com.sunnada.demo.common.SysFun;
import org.springframework.data.domain.PageImpl;

import javax.servlet.http.HttpServletRequest;

/**
 * @program: mybatisproject2
 * @description: 设置分页控件对象里的参数方法
 * @author: 李瑞益
 * @create: 2018-11-01 19:20
 **/
public class PageController {

    /**
     * 设置分页控件里的参数值
     * @param cout 页总数
     * @param pagerItem 分页对象
     * @param request 请求
     * @return
     */
    public PagerItem setPage(long cout , PagerItem pagerItem, HttpServletRequest request){
        pagerItem.changeRowCount(cout);
        pagerItem.changeUrl(SysFun.generalUrl(request.getRequestURI(),request.getQueryString()));
        return pagerItem;
    }
}
